package com.example.customviewtest.vertical_viewpager

import android.view.View
import androidx.viewpager.widget.ViewPager

/**
 * @auther XuDan on 2020/7/22.
 */
class VerticalPageTransformer : ViewPager.PageTransformer {
    override fun transformPage(view: View, position: Float) {
        if (position >= -1 && position <= 1) {
            view.translationX = view.width * (-position)
            val y_position = position * view.height
            view.translationY = y_position
        }
    }
}